<?php
/**
 * Created by PhpStorm.
 * User: 64423
 * Date: 2018/10/11
 * Time: 17:43
 */

namespace app\shop\model;


use think\Model;

class CouponModel extends Model
{
    protected $table = 'dp_coupon';

    public static function getAllList()
    {
        return self::paginate(10);
    }

    public static function store($data, $id=0)
    {
        if($id == 0){
            $data['add_time'] = time();
            return self::insert($data);
        }else{
            return self::where('id', $id)->update($data);
        }
    }

    public static function getOne($id=0)
    {
        return self::where('id', $id)->find();
    }

    public static function del($ids=0)
    {
        return self::where('id',$ids)->delete();
    }
}